{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Example training/test a model with pre-trained M2D\n",
    "\n",
    "The following will run an experiment using M2D on the 2nd stratified split of the CirCor dataset using a detailed command line instead of the batch scripts we actually used.\n",
    "\n",
    "- The command line is:\n",
    "    ```sh\n",
    "    python circor_eval.py config/m2d.yaml circor2 weight_file=../m2d_vit_base-80x608p16x16-221006-mr7_enconly/checkpoint-300.pth,encoder_only=True,freeze_embed=True --lr=0.00025 --freq_mask 0 --time_mask 0 --training_mask 0.2 --mixup 0.0 --rrc False --epochs 50 --warmup_epochs 5 --seed 7 --batch_size 32\n",
    "    ```\n",
    "- You need to download the pre-trained M2D weight if you do not have it:\n",
    "    ```sh\n",
    "    wget https://github.com/nttcslab/m2d/releases/download/v0.1.0/m2d_vit_base-80x608p16x16-221006-mr7_enconly.zip\n",
    "    unzip m2d_vit_base-80x608p16x16-221006-mr7_enconly.zip\n",
    "    ```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Run fine-tuning in the folder `evar`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/lab/m2d/app/circor/evar\n"
     ]
    }
   ],
   "source": [
    "%cd evar"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/home/dl/anaconda3/envs/ar/lib/python3.8/site-packages/nnAudio/Spectrogram.py:4: Warning: importing Spectrogram subpackage will be deprecated soon. You should import the feature extractor from the feature subpackage. See actual documentation.\n",
      "  warnings.warn(\n",
      "weight_file=../m2d_vit_base-80x608p16x16-221006-mr7_enconly/checkpoint-300.pth,encoder_only=True,freeze_embed=True\n",
      "+task_metadata=evar/metadata/circor2.csv,+task_data=work/16k/circor2,+unit_samples=80000\n",
      "\n",
      "Logging to logs/m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963/log.txt\n",
      "{'audio_repr': 'ar_m2d.AR_M2D', 'weight_file': '../m2d_vit_base-80x608p16x16-221006-mr7_enconly/checkpoint-300.pth', 'feature_d': 3840, 'sample_rate': 16000, 'n_fft': 400, 'window_size': 400, 'hop_size': 160, 'n_mels': 80, 'f_min': 50, 'f_max': 8000, 'window': 'hanning', 'mean': -7.1, 'std': 4.2, 'output_layers': [-1], 'encoder_only': True, 'dur_frames': None, 'freeze_embed': True, 'flat_features': False, 'batch_size': 128, 'lr_lineareval': 3e-05, 'report_per_epochs': 50, 'early_stop_epochs': 20, 'training_mask': 0.2, 'warmup_epochs': 5, 'mixup': 0.0, 'ft_bs': 32, 'ft_lr': 2.0, 'ft_early_stop_epochs': -1, 'ft_epochs': 50, 'ft_freq_mask': 0, 'ft_time_mask': 0, 'ft_noise': 0.0, 'ft_rrc': False, 'name': '', 'task_metadata': 'evar/metadata/circor2.csv', 'task_data': 'work/16k/circor2', 'unit_samples': 80000, 'id': 'm2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963', 'task_name': 'circor2', 'return_filename': False, 'optim': 'sgd', 'unit_sec': None, 'data_path': 'work', 'runtime_cfg': {'lr': 0.00025, 'seed': 7, 'hidden': [], 'mixup': 0.0, 'bs': 32, 'freq_mask': 0, 'time_mask': 0, 'rrc': False, 'epochs': 50, 'early_stop_epochs': -1, 'n_class': 3, 'id': '055fb028'}}\n",
      "\n",
      "🚀 Start fine-tuning  with logging in logs/m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963\n",
      "Train:17986, valid:2570, test:6805, multi label:False, balanced:False\n",
      "Creating model: m2d_vit_base_encoder_only({'img_size': [80, 608], 'patch_size': [16, 16], 'decoder_depth': 8, 'norm_stats': tensor([-7.1000,  4.2000])})\n",
      "/lab/M2D2022prep/app/circor/evar/../m2d/models_mae.py:784: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).\n",
      "  self.norm_stats = nn.Parameter(torch.tensor(norm_stats), requires_grad=False)\n",
      " using 151 parameters from ../m2d_vit_base-80x608p16x16-221006-mr7_enconly/checkpoint-300.pth\n",
      " (dropped: [] )\n",
      "<All keys matched successfully>\n",
      "<All keys matched successfully>\n",
      "using random_structured_mask().\n",
      " ** Freeze patch_embed **\n",
      "PatchEmbed(\n",
      "  (proj): Conv2d(1, 768, kernel_size=(16, 16), stride=(16, 16))\n",
      "  (norm): Identity()\n",
      ")\n",
      "{'audio_repr': 'ar_m2d.AR_M2D', 'weight_file': '../m2d_vit_base-80x608p16x16-221006-mr7_enconly/checkpoint-300.pth', 'feature_d': 768, 'sample_rate': 16000, 'n_fft': 400, 'window_size': 400, 'hop_size': 160, 'n_mels': 80, 'f_min': 50, 'f_max': 8000, 'window': 'hanning', 'mean': tensor(-7.1000), 'std': tensor(4.2000), 'output_layers': [-1], 'encoder_only': True, 'dur_frames': None, 'freeze_embed': True, 'flat_features': True, 'batch_size': 128, 'lr_lineareval': 3e-05, 'report_per_epochs': 50, 'early_stop_epochs': 20, 'training_mask': 0.2, 'warmup_epochs': 5, 'mixup': 0.0, 'ft_bs': 32, 'ft_lr': 2.0, 'ft_early_stop_epochs': -1, 'ft_epochs': 50, 'ft_freq_mask': 0, 'ft_time_mask': 0, 'ft_noise': 0.0, 'ft_rrc': False, 'name': '', 'task_metadata': 'evar/metadata/circor2.csv', 'task_data': 'work/16k/circor2', 'unit_samples': 80000, 'id': 'm2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963', 'task_name': 'circor2', 'return_filename': False, 'optim': 'sgd', 'unit_sec': None, 'data_path': 'work', 'runtime_cfg': {'lr': 0.00025, 'seed': 7, 'hidden': [], 'mixup': 0.0, 'bs': 32, 'freq_mask': 0, 'time_mask': 0, 'rrc': False, 'epochs': 50, 'early_stop_epochs': -1, 'n_class': 3, 'id': '055fb028'}, 'input_size': [80, 608], 'patch_size': [16, 16], 'sr': '16k', 'model': 'm2d_vit_base_encoder_only', 'decoder_depth': 8}\n",
      "Model input size: [80, 608]\n",
      "Using weights: ../m2d_vit_base-80x608p16x16-221006-mr7_enconly/checkpoint-300.pth\n",
      "training_mask: 0.2\n",
      "flat_features: True\n",
      "Runtime MelSpectrogram(16000, 400, 400, 160, 80, 50, 8000):\n",
      "MelSpectrogram(\n",
      "  Mel filter banks size = (80, 201), trainable_mel=False\n",
      "  (stft): STFT(n_fft=400, Fourier Kernel size=(201, 1, 400), iSTFT=False, trainable=False)\n",
      ")\n",
      " using spectrogram norimalization stats: [tensor(-7.1000), tensor(4.2000)]\n",
      "768 [] 3\n",
      "Backbone encoder:\n",
      "Total number of parameters: 85,400,834 (trainable 85,056,768)\n",
      "Trainable parameters: ['runtime.backbone.cls_token', 'runtime.backbone.blocks.0.norm1.weight', 'runtime.backbone.blocks.0.norm1.bias', 'runtime.backbone.blocks.0.attn.qkv.weight', 'runtime.backbone.blocks.0.attn.qkv.bias', 'runtime.backbone.blocks.0.attn.proj.weight', 'runtime.backbone.blocks.0.attn.proj.bias', 'runtime.backbone.blocks.0.norm2.weight', 'runtime.backbone.blocks.0.norm2.bias', 'runtime.backbone.blocks.0.mlp.fc1.weight'] ...\n",
      "Others are frozen such as: ['runtime.backbone.pos_embed', 'runtime.backbone.norm_stats', 'runtime.backbone.patch_embed.proj.weight'] ...\n",
      "Head:\n",
      "Total number of parameters: 2,307 (trainable 2,307)\n",
      "Trainable parameters: ['mlp.mlp.0.weight', 'mlp.mlp.0.bias']\n",
      "Others are frozen such as: [] \n",
      "Head = TaskHead(\n",
      "  (norm): BatchNorm1d(768, eps=1e-05, momentum=0.1, affine=False, track_running_stats=True)\n",
      "  (mlp): MLP(\n",
      "    (mlp): Sequential(\n",
      "      (0): Linear(in_features=768, out_features=3, bias=True)\n",
      "    )\n",
      "  )\n",
      ")\n",
      "Using CrossEntropyLoss(weight=[0.43989532 1.75558809 6.36447275]), eval_acc, and SGD (\n",
      "Parameter Group 0\n",
      "    dampening: 0\n",
      "    differentiable: False\n",
      "    foreach: None\n",
      "    initial_lr: 0.00025\n",
      "    lr: 0\n",
      "    maximize: False\n",
      "    momentum: 0.9\n",
      "    nesterov: False\n",
      "    weight_decay: 0\n",
      ")\n",
      " using mixup with alpha=0.0\n",
      "Epoch [0] iter: 0/563, elapsed: 2.371s, lr: 0.00000000 loss: 2.17761857\n",
      "Epoch [0] iter: 56/563, elapsed: 8.573s, lr: 0.00000497 loss: 1.03611388\n",
      "Epoch [0] iter: 112/563, elapsed: 8.652s, lr: 0.00000995 loss: 0.71855844\n",
      "Epoch [0] iter: 168/563, elapsed: 8.701s, lr: 0.00001492 loss: 1.01752379\n",
      "Epoch [0] iter: 224/563, elapsed: 8.748s, lr: 0.00001989 loss: 1.33136937\n",
      "Epoch [0] iter: 280/563, elapsed: 8.779s, lr: 0.00002487 loss: 1.72483967\n",
      "Epoch [0] iter: 336/563, elapsed: 8.813s, lr: 0.00002984 loss: 1.00702587\n",
      "Epoch [0] iter: 392/563, elapsed: 8.846s, lr: 0.00003481 loss: 0.89230916\n",
      "Epoch [0] iter: 448/563, elapsed: 8.865s, lr: 0.00003979 loss: 0.67246018\n",
      "Epoch [0] iter: 504/563, elapsed: 8.899s, lr: 0.00004476 loss: 0.91485815\n",
      "Epoch [0] iter: 560/563, elapsed: 8.925s, lr: 0.00004973 loss: 0.96395699\n",
      "validating\n",
      "Saved weight as logs/m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963/weights_ep0it562-0.36848_loss0.4959.pth\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 0/562: val acc: 0.36848, loss: 0.49586, best: 0.36848@0\n",
      "Epoch [1] iter: 0/563, elapsed: 7.388s, lr: 0.00005000 loss: 0.78453575\n",
      "Epoch [1] iter: 56/563, elapsed: 8.918s, lr: 0.00005497 loss: 1.23640450\n",
      "Epoch [1] iter: 112/563, elapsed: 8.928s, lr: 0.00005995 loss: 0.94804279\n",
      "Epoch [1] iter: 168/563, elapsed: 8.935s, lr: 0.00006492 loss: 1.28843549\n",
      "Epoch [1] iter: 224/563, elapsed: 8.927s, lr: 0.00006989 loss: 0.84078575\n",
      "Epoch [1] iter: 280/563, elapsed: 8.945s, lr: 0.00007487 loss: 0.79027248\n",
      "Epoch [1] iter: 336/563, elapsed: 8.968s, lr: 0.00007984 loss: 0.74043438\n",
      "Epoch [1] iter: 392/563, elapsed: 8.967s, lr: 0.00008481 loss: 0.94792240\n",
      "Epoch [1] iter: 448/563, elapsed: 8.977s, lr: 0.00008979 loss: 0.98333291\n",
      "Epoch [1] iter: 504/563, elapsed: 8.980s, lr: 0.00009476 loss: 0.88799213\n",
      "Epoch [1] iter: 560/563, elapsed: 8.974s, lr: 0.00009973 loss: 0.95208354\n",
      "validating\n",
      "Saved weight as logs/m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963/weights_ep1it562-0.47626_loss0.4981.pth\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 1/562: val acc: 0.47626, loss: 0.49811, best: 0.47626@1\n",
      "Epoch [2] iter: 0/563, elapsed: 7.276s, lr: 0.00010000 loss: 0.70493413\n",
      "Epoch [2] iter: 56/563, elapsed: 8.980s, lr: 0.00010497 loss: 0.69192850\n",
      "Epoch [2] iter: 112/563, elapsed: 8.982s, lr: 0.00010995 loss: 1.39389602\n",
      "Epoch [2] iter: 168/563, elapsed: 9.001s, lr: 0.00011492 loss: 0.59756544\n",
      "Epoch [2] iter: 224/563, elapsed: 9.005s, lr: 0.00011989 loss: 0.81129429\n",
      "Epoch [2] iter: 280/563, elapsed: 9.017s, lr: 0.00012487 loss: 0.86753921\n",
      "Epoch [2] iter: 336/563, elapsed: 8.998s, lr: 0.00012984 loss: 0.99991311\n",
      "Epoch [2] iter: 392/563, elapsed: 9.013s, lr: 0.00013481 loss: 0.64691902\n",
      "Epoch [2] iter: 448/563, elapsed: 9.009s, lr: 0.00013979 loss: 1.14047094\n",
      "Epoch [2] iter: 504/563, elapsed: 9.038s, lr: 0.00014476 loss: 0.56947235\n",
      "Epoch [2] iter: 560/563, elapsed: 9.035s, lr: 0.00014973 loss: 0.54957925\n",
      "validating\n",
      "Saved weight as logs/m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963/weights_ep2it562-0.54475_loss0.4805.pth\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 2/562: val acc: 0.54475, loss: 0.48055, best: 0.54475@2\n",
      "Epoch [3] iter: 0/563, elapsed: 7.329s, lr: 0.00015000 loss: 1.59080987\n",
      "Epoch [3] iter: 56/563, elapsed: 9.042s, lr: 0.00015497 loss: 1.27932431\n",
      "Epoch [3] iter: 112/563, elapsed: 9.063s, lr: 0.00015995 loss: 0.76264688\n",
      "Epoch [3] iter: 168/563, elapsed: 9.041s, lr: 0.00016492 loss: 0.79077628\n",
      "Epoch [3] iter: 224/563, elapsed: 9.057s, lr: 0.00016989 loss: 0.74461112\n",
      "Epoch [3] iter: 280/563, elapsed: 9.079s, lr: 0.00017487 loss: 0.78559936\n",
      "Epoch [3] iter: 336/563, elapsed: 9.071s, lr: 0.00017984 loss: 0.83360946\n",
      "Epoch [3] iter: 392/563, elapsed: 9.077s, lr: 0.00018481 loss: 0.77428812\n",
      "Epoch [3] iter: 448/563, elapsed: 9.082s, lr: 0.00018979 loss: 0.79984558\n",
      "Epoch [3] iter: 504/563, elapsed: 9.092s, lr: 0.00019476 loss: 1.25162291\n",
      "Epoch [3] iter: 560/563, elapsed: 9.113s, lr: 0.00019973 loss: 0.66410094\n",
      "validating\n",
      "Saved weight as logs/m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963/weights_ep3it562-0.55992_loss1.6697.pth\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 3/562: val acc: 0.55992, loss: 1.66973, best: 0.55992@3\n",
      "Epoch [4] iter: 0/563, elapsed: 7.462s, lr: 0.00020000 loss: 0.82459071\n",
      "Epoch [4] iter: 56/563, elapsed: 9.091s, lr: 0.00020497 loss: 0.89606609\n",
      "Epoch [4] iter: 112/563, elapsed: 9.098s, lr: 0.00020995 loss: 0.83985736\n",
      "Epoch [4] iter: 168/563, elapsed: 9.105s, lr: 0.00021492 loss: 1.00590807\n",
      "Epoch [4] iter: 224/563, elapsed: 9.130s, lr: 0.00021989 loss: 1.07822597\n",
      "Epoch [4] iter: 280/563, elapsed: 9.121s, lr: 0.00022487 loss: 1.07272788\n",
      "Epoch [4] iter: 336/563, elapsed: 9.130s, lr: 0.00022984 loss: 0.79699841\n",
      "Epoch [4] iter: 392/563, elapsed: 9.130s, lr: 0.00023481 loss: 0.68160385\n",
      "Epoch [4] iter: 448/563, elapsed: 9.123s, lr: 0.00023979 loss: 0.92635633\n",
      "Epoch [4] iter: 504/563, elapsed: 9.134s, lr: 0.00024476 loss: 1.07271782\n",
      "Epoch [4] iter: 560/563, elapsed: 9.162s, lr: 0.00024973 loss: 0.69595965\n",
      "validating\n",
      "Saved weight as logs/m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963/weights_ep4it562-0.67432_loss2.3382.pth\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 4/562: val acc: 0.67432, loss: 2.33824, best: 0.67432@4\n",
      "Epoch [5] iter: 0/563, elapsed: 7.454s, lr: 0.00024388 loss: 0.78319883\n",
      "Epoch [5] iter: 56/563, elapsed: 9.114s, lr: 0.00024364 loss: 0.99396666\n",
      "Epoch [5] iter: 112/563, elapsed: 9.154s, lr: 0.00024339 loss: 0.71279220\n",
      "Epoch [5] iter: 168/563, elapsed: 9.174s, lr: 0.00024314 loss: 1.02374309\n",
      "Epoch [5] iter: 224/563, elapsed: 9.160s, lr: 0.00024288 loss: 0.74661071\n",
      "Epoch [5] iter: 280/563, elapsed: 9.188s, lr: 0.00024262 loss: 0.62196593\n",
      "Epoch [5] iter: 336/563, elapsed: 9.175s, lr: 0.00024235 loss: 0.76151791\n",
      "Epoch [5] iter: 392/563, elapsed: 9.179s, lr: 0.00024208 loss: 0.85568054\n",
      "Epoch [5] iter: 448/563, elapsed: 9.173s, lr: 0.00024181 loss: 0.61531301\n",
      "Epoch [5] iter: 504/563, elapsed: 9.181s, lr: 0.00024153 loss: 0.79012415\n",
      "Epoch [5] iter: 560/563, elapsed: 9.182s, lr: 0.00024124 loss: 0.62489836\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 5/562: val acc: 0.61946, loss: 0.46654, best: 0.67432@4\n",
      "Epoch [6] iter: 0/563, elapsed: 7.177s, lr: 0.00024123 loss: 0.79185003\n",
      "Epoch [6] iter: 56/563, elapsed: 9.187s, lr: 0.00024094 loss: 0.93652376\n",
      "Epoch [6] iter: 112/563, elapsed: 9.186s, lr: 0.00024064 loss: 1.08556445\n",
      "Epoch [6] iter: 168/563, elapsed: 9.192s, lr: 0.00024034 loss: 0.72561156\n",
      "Epoch [6] iter: 224/563, elapsed: 9.207s, lr: 0.00024004 loss: 0.56151735\n",
      "Epoch [6] iter: 280/563, elapsed: 9.217s, lr: 0.00023973 loss: 0.84787515\n",
      "Epoch [6] iter: 336/563, elapsed: 9.281s, lr: 0.00023942 loss: 0.67512672\n",
      "Epoch [6] iter: 392/563, elapsed: 9.327s, lr: 0.00023910 loss: 0.63296892\n",
      "Epoch [6] iter: 448/563, elapsed: 9.266s, lr: 0.00023878 loss: 0.83778205\n",
      "Epoch [6] iter: 504/563, elapsed: 9.255s, lr: 0.00023846 loss: 0.62471151\n",
      "Epoch [6] iter: 560/563, elapsed: 9.320s, lr: 0.00023813 loss: 0.86999582\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 6/562: val acc: 0.48677, loss: 0.45447, best: 0.67432@4\n",
      "Epoch [7] iter: 0/563, elapsed: 7.241s, lr: 0.00023811 loss: 0.79743796\n",
      "Epoch [7] iter: 56/563, elapsed: 9.218s, lr: 0.00023777 loss: 0.68863418\n",
      "Epoch [7] iter: 112/563, elapsed: 9.388s, lr: 0.00023743 loss: 0.73677172\n",
      "Epoch [7] iter: 168/563, elapsed: 9.345s, lr: 0.00023709 loss: 0.78976361\n",
      "Epoch [7] iter: 224/563, elapsed: 9.378s, lr: 0.00023674 loss: 0.58925086\n",
      "Epoch [7] iter: 280/563, elapsed: 9.396s, lr: 0.00023639 loss: 0.86338193\n",
      "Epoch [7] iter: 336/563, elapsed: 9.332s, lr: 0.00023603 loss: 0.63947097\n",
      "Epoch [7] iter: 392/563, elapsed: 9.413s, lr: 0.00023567 loss: 0.86109097\n",
      "Epoch [7] iter: 448/563, elapsed: 9.384s, lr: 0.00023531 loss: 0.65255996\n",
      "Epoch [7] iter: 504/563, elapsed: 9.434s, lr: 0.00023494 loss: 0.90268933\n",
      "Epoch [7] iter: 560/563, elapsed: 9.411s, lr: 0.00023456 loss: 0.65993286\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 7/562: val acc: 0.64514, loss: 0.44569, best: 0.67432@4\n",
      "Epoch [8] iter: 0/563, elapsed: 7.333s, lr: 0.00023454 loss: 0.73022070\n",
      "Epoch [8] iter: 56/563, elapsed: 9.305s, lr: 0.00023417 loss: 0.68734457\n",
      "Epoch [8] iter: 112/563, elapsed: 9.387s, lr: 0.00023378 loss: 0.83108411\n",
      "Epoch [8] iter: 168/563, elapsed: 9.440s, lr: 0.00023340 loss: 0.60022119\n",
      "Epoch [8] iter: 224/563, elapsed: 9.474s, lr: 0.00023301 loss: 0.76354664\n",
      "Epoch [8] iter: 280/563, elapsed: 9.522s, lr: 0.00023261 loss: 0.66907766\n",
      "Epoch [8] iter: 336/563, elapsed: 9.462s, lr: 0.00023221 loss: 0.92498999\n",
      "Epoch [8] iter: 392/563, elapsed: 9.460s, lr: 0.00023181 loss: 0.56265211\n",
      "Epoch [8] iter: 448/563, elapsed: 9.493s, lr: 0.00023140 loss: 0.67608578\n",
      "Epoch [8] iter: 504/563, elapsed: 9.443s, lr: 0.00023099 loss: 0.67891251\n",
      "Epoch [8] iter: 560/563, elapsed: 9.539s, lr: 0.00023057 loss: 0.55284559\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 8/562: val acc: 0.60661, loss: 0.63317, best: 0.67432@4\n",
      "Epoch [9] iter: 0/563, elapsed: 7.316s, lr: 0.00023055 loss: 0.56624461\n",
      "Epoch [9] iter: 56/563, elapsed: 9.344s, lr: 0.00023013 loss: 0.81368249\n",
      "Epoch [9] iter: 112/563, elapsed: 9.548s, lr: 0.00022970 loss: 0.52019719\n",
      "Epoch [9] iter: 168/563, elapsed: 9.510s, lr: 0.00022928 loss: 0.89189547\n",
      "Epoch [9] iter: 224/563, elapsed: 9.638s, lr: 0.00022884 loss: 0.70742017\n",
      "Epoch [9] iter: 280/563, elapsed: 9.504s, lr: 0.00022841 loss: 0.68541912\n",
      "Epoch [9] iter: 336/563, elapsed: 9.577s, lr: 0.00022796 loss: 0.70885736\n",
      "Epoch [9] iter: 392/563, elapsed: 9.643s, lr: 0.00022752 loss: 0.66541816\n",
      "Epoch [9] iter: 448/563, elapsed: 9.582s, lr: 0.00022707 loss: 0.68961220\n",
      "Epoch [9] iter: 504/563, elapsed: 9.632s, lr: 0.00022662 loss: 0.63267377\n",
      "Epoch [9] iter: 560/563, elapsed: 9.601s, lr: 0.00022616 loss: 0.58372527\n",
      "validating\n",
      "Saved weight as logs/m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963/weights_ep9it562-0.70623_loss2.3424.pth\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 9/562: val acc: 0.70623, loss: 2.34244, best: 0.70623@9\n",
      "Epoch [10] iter: 0/563, elapsed: 7.694s, lr: 0.00022614 loss: 0.53613121\n",
      "Epoch [10] iter: 56/563, elapsed: 9.398s, lr: 0.00022568 loss: 0.79221573\n",
      "Epoch [10] iter: 112/563, elapsed: 9.565s, lr: 0.00022521 loss: 0.59419294\n",
      "Epoch [10] iter: 168/563, elapsed: 9.536s, lr: 0.00022474 loss: 0.67229884\n",
      "Epoch [10] iter: 224/563, elapsed: 9.587s, lr: 0.00022427 loss: 0.46459561\n",
      "Epoch [10] iter: 280/563, elapsed: 9.595s, lr: 0.00022379 loss: 0.59985918\n",
      "Epoch [10] iter: 336/563, elapsed: 9.627s, lr: 0.00022331 loss: 0.99829580\n",
      "Epoch [10] iter: 392/563, elapsed: 9.595s, lr: 0.00022283 loss: 0.91293254\n",
      "Epoch [10] iter: 448/563, elapsed: 9.640s, lr: 0.00022234 loss: 0.74679890\n",
      "Epoch [10] iter: 504/563, elapsed: 9.701s, lr: 0.00022185 loss: 0.54397560\n",
      "Epoch [10] iter: 560/563, elapsed: 9.630s, lr: 0.00022135 loss: 0.50919640\n",
      "validating\n",
      "Saved weight as logs/m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963/weights_ep10it562-0.72218_loss2.6159.pth\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 10/562: val acc: 0.72218, loss: 2.61588, best: 0.72218@10\n",
      "Epoch [11] iter: 0/563, elapsed: 7.772s, lr: 0.00022133 loss: 1.01002570\n",
      "Epoch [11] iter: 56/563, elapsed: 9.429s, lr: 0.00022083 loss: 0.51411866\n",
      "Epoch [11] iter: 112/563, elapsed: 9.601s, lr: 0.00022032 loss: 0.64916565\n",
      "Epoch [11] iter: 168/563, elapsed: 9.610s, lr: 0.00021982 loss: 0.62883208\n",
      "Epoch [11] iter: 224/563, elapsed: 9.672s, lr: 0.00021930 loss: 0.59386992\n",
      "Epoch [11] iter: 280/563, elapsed: 9.625s, lr: 0.00021879 loss: 0.70823602\n",
      "Epoch [11] iter: 336/563, elapsed: 9.648s, lr: 0.00021827 loss: 0.64741750\n",
      "Epoch [11] iter: 392/563, elapsed: 9.672s, lr: 0.00021775 loss: 0.65202212\n",
      "Epoch [11] iter: 448/563, elapsed: 9.772s, lr: 0.00021722 loss: 0.82783359\n",
      "Epoch [11] iter: 504/563, elapsed: 9.682s, lr: 0.00021670 loss: 0.70103760\n",
      "Epoch [11] iter: 560/563, elapsed: 9.687s, lr: 0.00021616 loss: 0.69390174\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 11/562: val acc: 0.69883, loss: 0.46105, best: 0.72218@10\n",
      "Epoch [12] iter: 0/563, elapsed: 7.496s, lr: 0.00021613 loss: 0.80167933\n",
      "Epoch [12] iter: 56/563, elapsed: 9.528s, lr: 0.00021560 loss: 0.58528086\n",
      "Epoch [12] iter: 112/563, elapsed: 9.753s, lr: 0.00021506 loss: 0.56287394\n",
      "Epoch [12] iter: 168/563, elapsed: 9.692s, lr: 0.00021452 loss: 0.49452332\n",
      "Epoch [12] iter: 224/563, elapsed: 9.684s, lr: 0.00021397 loss: 0.72626111\n",
      "Epoch [12] iter: 280/563, elapsed: 9.650s, lr: 0.00021342 loss: 0.79083665\n",
      "Epoch [12] iter: 336/563, elapsed: 9.636s, lr: 0.00021286 loss: 0.53847429\n",
      "Epoch [12] iter: 392/563, elapsed: 9.682s, lr: 0.00021231 loss: 0.62505910\n",
      "Epoch [12] iter: 448/563, elapsed: 9.733s, lr: 0.00021175 loss: 0.67569646\n",
      "Epoch [12] iter: 504/563, elapsed: 9.708s, lr: 0.00021118 loss: 0.78500341\n",
      "Epoch [12] iter: 560/563, elapsed: 9.733s, lr: 0.00021061 loss: 0.53901263\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 12/562: val acc: 0.70195, loss: 0.58139, best: 0.72218@10\n",
      "Epoch [13] iter: 0/563, elapsed: 7.541s, lr: 0.00021058 loss: 0.64859261\n",
      "Epoch [13] iter: 56/563, elapsed: 9.540s, lr: 0.00021001 loss: 0.97509383\n",
      "Epoch [13] iter: 112/563, elapsed: 9.667s, lr: 0.00020944 loss: 0.60522675\n",
      "Epoch [13] iter: 168/563, elapsed: 9.734s, lr: 0.00020886 loss: 0.46430936\n",
      "Epoch [13] iter: 224/563, elapsed: 9.714s, lr: 0.00020828 loss: 0.82847195\n",
      "Epoch [13] iter: 280/563, elapsed: 9.829s, lr: 0.00020770 loss: 0.69582601\n",
      "Epoch [13] iter: 336/563, elapsed: 9.719s, lr: 0.00020711 loss: 0.71770018\n",
      "Epoch [13] iter: 392/563, elapsed: 9.683s, lr: 0.00020652 loss: 0.73717438\n",
      "Epoch [13] iter: 448/563, elapsed: 9.796s, lr: 0.00020593 loss: 0.48758147\n",
      "Epoch [13] iter: 504/563, elapsed: 9.774s, lr: 0.00020533 loss: 0.68627720\n",
      "Epoch [13] iter: 560/563, elapsed: 9.713s, lr: 0.00020473 loss: 0.65218198\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 13/562: val acc: 0.70973, loss: 0.60624, best: 0.72218@10\n",
      "Epoch [14] iter: 0/563, elapsed: 7.635s, lr: 0.00020470 loss: 0.44788028\n",
      "Epoch [14] iter: 56/563, elapsed: 9.618s, lr: 0.00020409 loss: 0.78057535\n",
      "Epoch [14] iter: 112/563, elapsed: 9.756s, lr: 0.00020349 loss: 0.48855346\n",
      "Epoch [14] iter: 168/563, elapsed: 9.762s, lr: 0.00020288 loss: 0.75105927\n",
      "Epoch [14] iter: 224/563, elapsed: 9.788s, lr: 0.00020226 loss: 0.54348431\n",
      "Epoch [14] iter: 280/563, elapsed: 9.812s, lr: 0.00020165 loss: 1.80587237\n",
      "Epoch [14] iter: 336/563, elapsed: 9.833s, lr: 0.00020103 loss: 0.63345618\n",
      "Epoch [14] iter: 392/563, elapsed: 9.789s, lr: 0.00020041 loss: 0.70174804\n",
      "Epoch [14] iter: 448/563, elapsed: 9.858s, lr: 0.00019979 loss: 0.80859357\n",
      "Epoch [14] iter: 504/563, elapsed: 9.773s, lr: 0.00019916 loss: 0.64301360\n",
      "Epoch [14] iter: 560/563, elapsed: 9.890s, lr: 0.00019853 loss: 0.81944224\n",
      "validating\n",
      "Saved weight as logs/m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963/weights_ep14it562-0.75720_loss0.4507.pth\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 14/562: val acc: 0.75720, loss: 0.45065, best: 0.75720@14\n",
      "Epoch [15] iter: 0/563, elapsed: 7.982s, lr: 0.00019849 loss: 0.51777242\n",
      "Epoch [15] iter: 56/563, elapsed: 9.541s, lr: 0.00019786 loss: 0.45050974\n",
      "Epoch [15] iter: 112/563, elapsed: 9.727s, lr: 0.00019722 loss: 0.68347981\n",
      "Epoch [15] iter: 168/563, elapsed: 9.716s, lr: 0.00019659 loss: 0.52213888\n",
      "Epoch [15] iter: 224/563, elapsed: 9.760s, lr: 0.00019594 loss: 0.59124621\n",
      "Epoch [15] iter: 280/563, elapsed: 9.876s, lr: 0.00019530 loss: 0.61337442\n",
      "Epoch [15] iter: 336/563, elapsed: 9.779s, lr: 0.00019465 loss: 0.51794199\n",
      "Epoch [15] iter: 392/563, elapsed: 9.738s, lr: 0.00019400 loss: 0.82389010\n",
      "Epoch [15] iter: 448/563, elapsed: 9.875s, lr: 0.00019335 loss: 0.61470159\n",
      "Epoch [15] iter: 504/563, elapsed: 9.772s, lr: 0.00019269 loss: 0.46661968\n",
      "Epoch [15] iter: 560/563, elapsed: 9.869s, lr: 0.00019204 loss: 0.61338055\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 15/562: val acc: 0.69183, loss: 0.60674, best: 0.75720@14\n",
      "Epoch [16] iter: 0/563, elapsed: 7.630s, lr: 0.00019200 loss: 0.56077194\n",
      "Epoch [16] iter: 56/563, elapsed: 9.691s, lr: 0.00019134 loss: 0.77127680\n",
      "Epoch [16] iter: 112/563, elapsed: 9.822s, lr: 0.00019068 loss: 0.67883329\n",
      "Epoch [16] iter: 168/563, elapsed: 9.793s, lr: 0.00019001 loss: 0.63208898\n",
      "Epoch [16] iter: 224/563, elapsed: 9.840s, lr: 0.00018934 loss: 0.60478091\n",
      "Epoch [16] iter: 280/563, elapsed: 9.775s, lr: 0.00018867 loss: 0.67004465\n",
      "Epoch [16] iter: 336/563, elapsed: 9.940s, lr: 0.00018800 loss: 0.82611649\n",
      "Epoch [16] iter: 392/563, elapsed: 9.852s, lr: 0.00018732 loss: 0.49863586\n",
      "Epoch [16] iter: 448/563, elapsed: 9.892s, lr: 0.00018665 loss: 0.60221340\n",
      "Epoch [16] iter: 504/563, elapsed: 9.898s, lr: 0.00018596 loss: 0.48602710\n",
      "Epoch [16] iter: 560/563, elapsed: 9.829s, lr: 0.00018528 loss: 0.50835436\n",
      "validating\n",
      "Saved weight as logs/m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963/weights_ep16it562-0.80039_loss0.4468.pth\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 16/562: val acc: 0.80039, loss: 0.44680, best: 0.80039@16\n",
      "Epoch [17] iter: 0/563, elapsed: 7.948s, lr: 0.00018525 loss: 0.52246121\n",
      "Epoch [17] iter: 56/563, elapsed: 9.575s, lr: 0.00018456 loss: 0.71553445\n",
      "Epoch [17] iter: 112/563, elapsed: 9.729s, lr: 0.00018387 loss: 0.52432863\n",
      "Epoch [17] iter: 168/563, elapsed: 9.865s, lr: 0.00018318 loss: 0.57112476\n",
      "Epoch [17] iter: 224/563, elapsed: 9.852s, lr: 0.00018249 loss: 0.91662951\n",
      "Epoch [17] iter: 280/563, elapsed: 9.835s, lr: 0.00018179 loss: 0.53493267\n",
      "Epoch [17] iter: 336/563, elapsed: 9.863s, lr: 0.00018110 loss: 0.80127109\n",
      "Epoch [17] iter: 392/563, elapsed: 9.856s, lr: 0.00018040 loss: 0.58177638\n",
      "Epoch [17] iter: 448/563, elapsed: 9.807s, lr: 0.00017970 loss: 0.48492000\n",
      "Epoch [17] iter: 504/563, elapsed: 9.927s, lr: 0.00017899 loss: 0.78804136\n",
      "Epoch [17] iter: 560/563, elapsed: 9.828s, lr: 0.00017829 loss: 0.63213822\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 17/562: val acc: 0.73774, loss: 0.45597, best: 0.80039@16\n",
      "Epoch [18] iter: 0/563, elapsed: 7.540s, lr: 0.00017825 loss: 0.66923862\n",
      "Epoch [18] iter: 56/563, elapsed: 9.709s, lr: 0.00017754 loss: 0.50989734\n",
      "Epoch [18] iter: 112/563, elapsed: 9.845s, lr: 0.00017683 loss: 0.46156184\n",
      "Epoch [18] iter: 168/563, elapsed: 9.794s, lr: 0.00017612 loss: 0.46925093\n",
      "Epoch [18] iter: 224/563, elapsed: 9.891s, lr: 0.00017541 loss: 0.62688270\n",
      "Epoch [18] iter: 280/563, elapsed: 9.863s, lr: 0.00017469 loss: 0.65045628\n",
      "Epoch [18] iter: 336/563, elapsed: 9.920s, lr: 0.00017398 loss: 0.56945320\n",
      "Epoch [18] iter: 392/563, elapsed: 9.871s, lr: 0.00017326 loss: 0.61441932\n",
      "Epoch [18] iter: 448/563, elapsed: 9.939s, lr: 0.00017253 loss: 0.88056688\n",
      "Epoch [18] iter: 504/563, elapsed: 9.935s, lr: 0.00017181 loss: 0.68634908\n",
      "Epoch [18] iter: 560/563, elapsed: 9.964s, lr: 0.00017109 loss: 0.71390923\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 18/562: val acc: 0.74436, loss: 0.60558, best: 0.80039@16\n",
      "Epoch [19] iter: 0/563, elapsed: 7.706s, lr: 0.00017105 loss: 0.77723178\n",
      "Epoch [19] iter: 56/563, elapsed: 9.693s, lr: 0.00017032 loss: 0.58663235\n",
      "Epoch [19] iter: 112/563, elapsed: 9.883s, lr: 0.00016959 loss: 0.63689741\n",
      "Epoch [19] iter: 168/563, elapsed: 9.813s, lr: 0.00016886 loss: 0.58817960\n",
      "Epoch [19] iter: 224/563, elapsed: 9.937s, lr: 0.00016813 loss: 1.12742952\n",
      "Epoch [19] iter: 280/563, elapsed: 9.900s, lr: 0.00016739 loss: 0.58233828\n",
      "Epoch [19] iter: 336/563, elapsed: 9.944s, lr: 0.00016666 loss: 0.56454526\n",
      "Epoch [19] iter: 392/563, elapsed: 9.952s, lr: 0.00016592 loss: 0.88447922\n",
      "Epoch [19] iter: 448/563, elapsed: 9.909s, lr: 0.00016518 loss: 0.60904258\n",
      "Epoch [19] iter: 504/563, elapsed: 9.878s, lr: 0.00016444 loss: 0.69476914\n",
      "Epoch [19] iter: 560/563, elapsed: 9.870s, lr: 0.00016370 loss: 0.54345651\n",
      "validating\n",
      "Saved weight as logs/m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963/weights_ep19it562-0.81984_loss0.6059.pth\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 19/562: val acc: 0.81984, loss: 0.60593, best: 0.81984@19\n",
      "Epoch [20] iter: 0/563, elapsed: 8.232s, lr: 0.00016366 loss: 0.71259739\n",
      "Epoch [20] iter: 56/563, elapsed: 9.618s, lr: 0.00016292 loss: 0.72659726\n",
      "Epoch [20] iter: 112/563, elapsed: 9.838s, lr: 0.00016217 loss: 0.50645709\n",
      "Epoch [20] iter: 168/563, elapsed: 9.881s, lr: 0.00016143 loss: 0.70758389\n",
      "Epoch [20] iter: 224/563, elapsed: 9.819s, lr: 0.00016068 loss: 0.60453374\n",
      "Epoch [20] iter: 280/563, elapsed: 9.857s, lr: 0.00015993 loss: 0.71329447\n",
      "Epoch [20] iter: 336/563, elapsed: 9.893s, lr: 0.00015918 loss: 0.52555524\n",
      "Epoch [20] iter: 392/563, elapsed: 9.921s, lr: 0.00015843 loss: 0.70235986\n",
      "Epoch [20] iter: 448/563, elapsed: 9.888s, lr: 0.00015767 loss: 0.69967735\n",
      "Epoch [20] iter: 504/563, elapsed: 9.900s, lr: 0.00015692 loss: 0.48149003\n",
      "Epoch [20] iter: 560/563, elapsed: 9.918s, lr: 0.00015616 loss: 0.63914948\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 20/562: val acc: 0.79961, loss: 0.45436, best: 0.81984@19\n",
      "Epoch [21] iter: 0/563, elapsed: 7.806s, lr: 0.00015612 loss: 0.79754346\n",
      "Epoch [21] iter: 56/563, elapsed: 9.770s, lr: 0.00015537 loss: 0.42471139\n",
      "Epoch [21] iter: 112/563, elapsed: 9.783s, lr: 0.00015461 loss: 0.57548269\n",
      "Epoch [21] iter: 168/563, elapsed: 9.875s, lr: 0.00015385 loss: 0.89464184\n",
      "Epoch [21] iter: 224/563, elapsed: 9.934s, lr: 0.00015309 loss: 1.21650668\n",
      "Epoch [21] iter: 280/563, elapsed: 9.977s, lr: 0.00015233 loss: 0.74695496\n",
      "Epoch [21] iter: 336/563, elapsed: 9.880s, lr: 0.00015156 loss: 0.67637372\n",
      "Epoch [21] iter: 392/563, elapsed: 9.876s, lr: 0.00015080 loss: 0.57841857\n",
      "Epoch [21] iter: 448/563, elapsed: 10.000s, lr: 0.00015004 loss: 0.49087882\n",
      "Epoch [21] iter: 504/563, elapsed: 9.915s, lr: 0.00014927 loss: 0.41025411\n",
      "Epoch [21] iter: 560/563, elapsed: 9.929s, lr: 0.00014850 loss: 0.41056566\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 21/562: val acc: 0.75447, loss: 0.45978, best: 0.81984@19\n",
      "Epoch [22] iter: 0/563, elapsed: 7.674s, lr: 0.00014846 loss: 0.58521671\n",
      "Epoch [22] iter: 56/563, elapsed: 9.798s, lr: 0.00014770 loss: 0.63873546\n",
      "Epoch [22] iter: 112/563, elapsed: 9.955s, lr: 0.00014693 loss: 0.39165000\n",
      "Epoch [22] iter: 168/563, elapsed: 9.979s, lr: 0.00014616 loss: 0.74844601\n",
      "Epoch [22] iter: 224/563, elapsed: 9.952s, lr: 0.00014539 loss: 0.50554232\n",
      "Epoch [22] iter: 280/563, elapsed: 9.889s, lr: 0.00014462 loss: 0.59745805\n",
      "Epoch [22] iter: 336/563, elapsed: 9.985s, lr: 0.00014385 loss: 0.98587615\n",
      "Epoch [22] iter: 392/563, elapsed: 9.865s, lr: 0.00014307 loss: 0.56478947\n",
      "Epoch [22] iter: 448/563, elapsed: 9.956s, lr: 0.00014230 loss: 0.61353746\n",
      "Epoch [22] iter: 504/563, elapsed: 9.906s, lr: 0.00014153 loss: 0.62566286\n",
      "Epoch [22] iter: 560/563, elapsed: 9.857s, lr: 0.00014075 loss: 0.40805553\n",
      "validating\n",
      "Saved weight as logs/m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963/weights_ep22it562-0.82218_loss0.6055.pth\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 22/562: val acc: 0.82218, loss: 0.60549, best: 0.82218@22\n",
      "Epoch [23] iter: 0/563, elapsed: 8.049s, lr: 0.00014071 loss: 0.77503705\n",
      "Epoch [23] iter: 56/563, elapsed: 9.635s, lr: 0.00013994 loss: 0.55418131\n",
      "Epoch [23] iter: 112/563, elapsed: 9.836s, lr: 0.00013916 loss: 0.50186365\n",
      "Epoch [23] iter: 168/563, elapsed: 9.860s, lr: 0.00013838 loss: 0.83328621\n",
      "Epoch [23] iter: 224/563, elapsed: 9.864s, lr: 0.00013761 loss: 0.55698610\n",
      "Epoch [23] iter: 280/563, elapsed: 9.884s, lr: 0.00013683 loss: 0.47959676\n",
      "Epoch [23] iter: 336/563, elapsed: 9.856s, lr: 0.00013605 loss: 0.87712398\n",
      "Epoch [23] iter: 392/563, elapsed: 9.893s, lr: 0.00013527 loss: 0.67077590\n",
      "Epoch [23] iter: 448/563, elapsed: 9.940s, lr: 0.00013450 loss: 0.55312778\n",
      "Epoch [23] iter: 504/563, elapsed: 9.902s, lr: 0.00013372 loss: 0.53890568\n",
      "Epoch [23] iter: 560/563, elapsed: 9.942s, lr: 0.00013294 loss: 0.55712405\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 23/562: val acc: 0.80311, loss: 0.56110, best: 0.82218@22\n",
      "Epoch [24] iter: 0/563, elapsed: 7.569s, lr: 0.00013290 loss: 0.80617322\n",
      "Epoch [24] iter: 56/563, elapsed: 9.772s, lr: 0.00013212 loss: 0.46288542\n",
      "Epoch [24] iter: 112/563, elapsed: 9.904s, lr: 0.00013134 loss: 0.49782086\n",
      "Epoch [24] iter: 168/563, elapsed: 9.873s, lr: 0.00013056 loss: 0.57375203\n",
      "Epoch [24] iter: 224/563, elapsed: 9.940s, lr: 0.00012978 loss: 0.78731993\n",
      "Epoch [24] iter: 280/563, elapsed: 9.982s, lr: 0.00012900 loss: 0.76395607\n",
      "Epoch [24] iter: 336/563, elapsed: 9.884s, lr: 0.00012822 loss: 0.66844145\n",
      "Epoch [24] iter: 392/563, elapsed: 9.948s, lr: 0.00012743 loss: 0.73361968\n",
      "Epoch [24] iter: 448/563, elapsed: 9.883s, lr: 0.00012665 loss: 0.71192844\n",
      "Epoch [24] iter: 504/563, elapsed: 9.959s, lr: 0.00012587 loss: 0.47869821\n",
      "Epoch [24] iter: 560/563, elapsed: 9.941s, lr: 0.00012509 loss: 0.58547143\n",
      "validating\n",
      "Saved weight as logs/m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963/weights_ep24it562-0.85175_loss0.6055.pth\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 24/562: val acc: 0.85175, loss: 0.60549, best: 0.85175@24\n",
      "Epoch [25] iter: 0/563, elapsed: 7.985s, lr: 0.00012505 loss: 0.56650596\n",
      "Epoch [25] iter: 56/563, elapsed: 9.755s, lr: 0.00012427 loss: 0.61085613\n",
      "Epoch [25] iter: 112/563, elapsed: 9.910s, lr: 0.00012349 loss: 0.46173703\n",
      "Epoch [25] iter: 168/563, elapsed: 9.968s, lr: 0.00012271 loss: 0.53809954\n",
      "Epoch [25] iter: 224/563, elapsed: 9.879s, lr: 0.00012193 loss: 0.78991873\n",
      "Epoch [25] iter: 280/563, elapsed: 9.867s, lr: 0.00012115 loss: 0.65850161\n",
      "Epoch [25] iter: 336/563, elapsed: 9.943s, lr: 0.00012037 loss: 0.78269381\n",
      "Epoch [25] iter: 392/563, elapsed: 9.924s, lr: 0.00011959 loss: 0.44999874\n",
      "Epoch [25] iter: 448/563, elapsed: 9.961s, lr: 0.00011881 loss: 0.71212323\n",
      "Epoch [25] iter: 504/563, elapsed: 9.891s, lr: 0.00011803 loss: 0.55207091\n",
      "Epoch [25] iter: 560/563, elapsed: 9.951s, lr: 0.00011725 loss: 0.53292997\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 25/562: val acc: 0.81790, loss: 0.44495, best: 0.85175@24\n",
      "Epoch [26] iter: 0/563, elapsed: 7.618s, lr: 0.00011720 loss: 0.67222952\n",
      "Epoch [26] iter: 56/563, elapsed: 9.734s, lr: 0.00011643 loss: 0.44004530\n",
      "Epoch [26] iter: 112/563, elapsed: 9.927s, lr: 0.00011565 loss: 0.74770203\n",
      "Epoch [26] iter: 168/563, elapsed: 9.887s, lr: 0.00011487 loss: 0.47993169\n",
      "Epoch [26] iter: 224/563, elapsed: 9.983s, lr: 0.00011409 loss: 0.65354138\n",
      "Epoch [26] iter: 280/563, elapsed: 9.982s, lr: 0.00011331 loss: 0.51139105\n",
      "Epoch [26] iter: 336/563, elapsed: 9.995s, lr: 0.00011253 loss: 0.64853667\n",
      "Epoch [26] iter: 392/563, elapsed: 9.919s, lr: 0.00011176 loss: 0.62468370\n",
      "Epoch [26] iter: 448/563, elapsed: 9.989s, lr: 0.00011098 loss: 0.62714991\n",
      "Epoch [26] iter: 504/563, elapsed: 10.036s, lr: 0.00011021 loss: 0.61502599\n",
      "Epoch [26] iter: 560/563, elapsed: 9.887s, lr: 0.00010943 loss: 1.10750986\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 26/562: val acc: 0.78405, loss: 0.47392, best: 0.85175@24\n",
      "Epoch [27] iter: 0/563, elapsed: 7.662s, lr: 0.00010939 loss: 0.65578852\n",
      "Epoch [27] iter: 56/563, elapsed: 9.876s, lr: 0.00010862 loss: 0.59936910\n",
      "Epoch [27] iter: 112/563, elapsed: 9.843s, lr: 0.00010784 loss: 0.64497838\n",
      "Epoch [27] iter: 168/563, elapsed: 9.875s, lr: 0.00010707 loss: 0.68760858\n",
      "Epoch [27] iter: 224/563, elapsed: 9.933s, lr: 0.00010630 loss: 0.70433222\n",
      "Epoch [27] iter: 280/563, elapsed: 9.878s, lr: 0.00010552 loss: 0.93963818\n",
      "Epoch [27] iter: 336/563, elapsed: 9.946s, lr: 0.00010475 loss: 0.36961286\n",
      "Epoch [27] iter: 392/563, elapsed: 9.955s, lr: 0.00010398 loss: 0.72895725\n",
      "Epoch [27] iter: 448/563, elapsed: 9.893s, lr: 0.00010321 loss: 0.71540112\n",
      "Epoch [27] iter: 504/563, elapsed: 9.899s, lr: 0.00010245 loss: 0.49579356\n",
      "Epoch [27] iter: 560/563, elapsed: 9.961s, lr: 0.00010168 loss: 0.58862158\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 27/562: val acc: 0.80934, loss: 2.13895, best: 0.85175@24\n",
      "Epoch [28] iter: 0/563, elapsed: 7.868s, lr: 0.00010164 loss: 0.72490773\n",
      "Epoch [28] iter: 56/563, elapsed: 9.723s, lr: 0.00010087 loss: 0.51287731\n",
      "Epoch [28] iter: 112/563, elapsed: 9.928s, lr: 0.00010010 loss: 0.65368648\n",
      "Epoch [28] iter: 168/563, elapsed: 9.935s, lr: 0.00009934 loss: 0.68196720\n",
      "Epoch [28] iter: 224/563, elapsed: 9.930s, lr: 0.00009858 loss: 0.38767447\n",
      "Epoch [28] iter: 280/563, elapsed: 9.941s, lr: 0.00009781 loss: 0.52351807\n",
      "Epoch [28] iter: 336/563, elapsed: 9.863s, lr: 0.00009705 loss: 0.78809998\n",
      "Epoch [28] iter: 392/563, elapsed: 10.012s, lr: 0.00009629 loss: 0.72437871\n",
      "Epoch [28] iter: 448/563, elapsed: 9.908s, lr: 0.00009553 loss: 0.59079876\n",
      "Epoch [28] iter: 504/563, elapsed: 9.941s, lr: 0.00009477 loss: 0.68859839\n",
      "Epoch [28] iter: 560/563, elapsed: 9.970s, lr: 0.00009402 loss: 0.79749063\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 28/562: val acc: 0.82529, loss: 0.62050, best: 0.85175@24\n",
      "Epoch [29] iter: 0/563, elapsed: 7.810s, lr: 0.00009398 loss: 0.54521619\n",
      "Epoch [29] iter: 56/563, elapsed: 9.774s, lr: 0.00009322 loss: 0.54881438\n",
      "Epoch [29] iter: 112/563, elapsed: 9.892s, lr: 0.00009247 loss: 0.78149469\n",
      "Epoch [29] iter: 168/563, elapsed: 9.910s, lr: 0.00009171 loss: 0.76146602\n",
      "Epoch [29] iter: 224/563, elapsed: 9.921s, lr: 0.00009096 loss: 0.70674805\n",
      "Epoch [29] iter: 280/563, elapsed: 9.947s, lr: 0.00009021 loss: 0.49508681\n",
      "Epoch [29] iter: 336/563, elapsed: 9.917s, lr: 0.00008946 loss: 0.49053390\n",
      "Epoch [29] iter: 392/563, elapsed: 9.905s, lr: 0.00008871 loss: 0.57508367\n",
      "Epoch [29] iter: 448/563, elapsed: 9.956s, lr: 0.00008797 loss: 0.53685476\n",
      "Epoch [29] iter: 504/563, elapsed: 9.941s, lr: 0.00008722 loss: 0.67939573\n",
      "Epoch [29] iter: 560/563, elapsed: 9.910s, lr: 0.00008648 loss: 0.63775954\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 29/562: val acc: 0.83541, loss: 0.60537, best: 0.85175@24\n",
      "Epoch [30] iter: 0/563, elapsed: 7.848s, lr: 0.00008644 loss: 0.97175655\n",
      "Epoch [30] iter: 56/563, elapsed: 9.790s, lr: 0.00008570 loss: 1.21886443\n",
      "Epoch [30] iter: 112/563, elapsed: 9.935s, lr: 0.00008496 loss: 0.47082475\n",
      "Epoch [30] iter: 168/563, elapsed: 9.852s, lr: 0.00008422 loss: 0.60652553\n",
      "Epoch [30] iter: 224/563, elapsed: 9.866s, lr: 0.00008348 loss: 0.69975728\n",
      "Epoch [30] iter: 280/563, elapsed: 9.987s, lr: 0.00008274 loss: 0.66750313\n",
      "Epoch [30] iter: 336/563, elapsed: 9.907s, lr: 0.00008201 loss: 0.57960911\n",
      "Epoch [30] iter: 392/563, elapsed: 9.958s, lr: 0.00008128 loss: 0.97883241\n",
      "Epoch [30] iter: 448/563, elapsed: 9.889s, lr: 0.00008055 loss: 0.40103383\n",
      "Epoch [30] iter: 504/563, elapsed: 10.033s, lr: 0.00007982 loss: 0.94231316\n",
      "Epoch [30] iter: 560/563, elapsed: 9.895s, lr: 0.00007909 loss: 0.66835745\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 30/562: val acc: 0.79300, loss: 0.61739, best: 0.85175@24\n",
      "Epoch [31] iter: 0/563, elapsed: 7.745s, lr: 0.00007905 loss: 0.64322412\n",
      "Epoch [31] iter: 56/563, elapsed: 9.749s, lr: 0.00007833 loss: 0.65205712\n",
      "Epoch [31] iter: 112/563, elapsed: 9.880s, lr: 0.00007760 loss: 0.49701085\n",
      "Epoch [31] iter: 168/563, elapsed: 9.910s, lr: 0.00007688 loss: 0.56072723\n",
      "Epoch [31] iter: 224/563, elapsed: 9.975s, lr: 0.00007616 loss: 0.36412168\n",
      "Epoch [31] iter: 280/563, elapsed: 9.880s, lr: 0.00007545 loss: 0.54304248\n",
      "Epoch [31] iter: 336/563, elapsed: 9.879s, lr: 0.00007473 loss: 0.48731791\n",
      "Epoch [31] iter: 392/563, elapsed: 9.962s, lr: 0.00007402 loss: 0.99499497\n",
      "Epoch [31] iter: 448/563, elapsed: 9.948s, lr: 0.00007330 loss: 0.59727149\n",
      "Epoch [31] iter: 504/563, elapsed: 9.937s, lr: 0.00007259 loss: 0.66791196\n",
      "Epoch [31] iter: 560/563, elapsed: 10.005s, lr: 0.00007189 loss: 0.65869778\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 31/562: val acc: 0.79416, loss: 0.46061, best: 0.85175@24\n",
      "Epoch [32] iter: 0/563, elapsed: 7.741s, lr: 0.00007185 loss: 0.48628544\n",
      "Epoch [32] iter: 56/563, elapsed: 9.791s, lr: 0.00007114 loss: 0.56663548\n",
      "Epoch [32] iter: 112/563, elapsed: 9.867s, lr: 0.00007044 loss: 0.60146482\n",
      "Epoch [32] iter: 168/563, elapsed: 10.003s, lr: 0.00006974 loss: 0.55752252\n",
      "Epoch [32] iter: 224/563, elapsed: 9.941s, lr: 0.00006904 loss: 0.81982692\n",
      "Epoch [32] iter: 280/563, elapsed: 9.972s, lr: 0.00006834 loss: 0.80706043\n",
      "Epoch [32] iter: 336/563, elapsed: 9.934s, lr: 0.00006765 loss: 0.46226568\n",
      "Epoch [32] iter: 392/563, elapsed: 9.977s, lr: 0.00006696 loss: 0.50906648\n",
      "Epoch [32] iter: 448/563, elapsed: 9.962s, lr: 0.00006627 loss: 0.59909738\n",
      "Epoch [32] iter: 504/563, elapsed: 9.942s, lr: 0.00006558 loss: 0.76142218\n",
      "Epoch [32] iter: 560/563, elapsed: 9.999s, lr: 0.00006489 loss: 0.65587973\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 32/562: val acc: 0.82101, loss: 0.45196, best: 0.85175@24\n",
      "Epoch [33] iter: 0/563, elapsed: 7.637s, lr: 0.00006485 loss: 0.48934367\n",
      "Epoch [33] iter: 56/563, elapsed: 9.812s, lr: 0.00006417 loss: 0.85859586\n",
      "Epoch [33] iter: 112/563, elapsed: 9.862s, lr: 0.00006349 loss: 0.58523598\n",
      "Epoch [33] iter: 168/563, elapsed: 9.902s, lr: 0.00006281 loss: 0.68596606\n",
      "Epoch [33] iter: 224/563, elapsed: 9.928s, lr: 0.00006214 loss: 0.82548214\n",
      "Epoch [33] iter: 280/563, elapsed: 9.948s, lr: 0.00006146 loss: 0.65369155\n",
      "Epoch [33] iter: 336/563, elapsed: 9.968s, lr: 0.00006079 loss: 0.85429916\n",
      "Epoch [33] iter: 392/563, elapsed: 9.941s, lr: 0.00006012 loss: 0.84065255\n",
      "Epoch [33] iter: 448/563, elapsed: 9.937s, lr: 0.00005946 loss: 0.54201610\n",
      "Epoch [33] iter: 504/563, elapsed: 9.992s, lr: 0.00005879 loss: 0.47419790\n",
      "Epoch [33] iter: 560/563, elapsed: 9.887s, lr: 0.00005813 loss: 0.49116872\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 33/562: val acc: 0.80856, loss: 0.55806, best: 0.85175@24\n",
      "Epoch [34] iter: 0/563, elapsed: 7.736s, lr: 0.00005810 loss: 0.51563620\n",
      "Epoch [34] iter: 56/563, elapsed: 9.791s, lr: 0.00005744 loss: 0.50652438\n",
      "Epoch [34] iter: 112/563, elapsed: 9.942s, lr: 0.00005679 loss: 0.58800022\n",
      "Epoch [34] iter: 168/563, elapsed: 9.895s, lr: 0.00005613 loss: 0.75707382\n",
      "Epoch [34] iter: 224/563, elapsed: 9.958s, lr: 0.00005548 loss: 0.40478026\n",
      "Epoch [34] iter: 280/563, elapsed: 9.954s, lr: 0.00005483 loss: 0.51615104\n",
      "Epoch [34] iter: 336/563, elapsed: 9.911s, lr: 0.00005419 loss: 0.70538119\n",
      "Epoch [34] iter: 392/563, elapsed: 9.950s, lr: 0.00005355 loss: 0.38167402\n",
      "Epoch [34] iter: 448/563, elapsed: 9.991s, lr: 0.00005291 loss: 0.46291847\n",
      "Epoch [34] iter: 504/563, elapsed: 9.882s, lr: 0.00005227 loss: 0.58537408\n",
      "Epoch [34] iter: 560/563, elapsed: 9.887s, lr: 0.00005164 loss: 0.83246829\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 34/562: val acc: 0.84475, loss: 0.60570, best: 0.85175@24\n",
      "Epoch [35] iter: 0/563, elapsed: 7.661s, lr: 0.00005161 loss: 0.78865269\n",
      "Epoch [35] iter: 56/563, elapsed: 9.797s, lr: 0.00005098 loss: 0.60134892\n",
      "Epoch [35] iter: 112/563, elapsed: 9.869s, lr: 0.00005035 loss: 0.82381389\n",
      "Epoch [35] iter: 168/563, elapsed: 9.910s, lr: 0.00004972 loss: 0.58704491\n",
      "Epoch [35] iter: 224/563, elapsed: 9.925s, lr: 0.00004910 loss: 0.56300994\n",
      "Epoch [35] iter: 280/563, elapsed: 9.859s, lr: 0.00004848 loss: 0.75232630\n",
      "Epoch [35] iter: 336/563, elapsed: 9.920s, lr: 0.00004787 loss: 0.70599130\n",
      "Epoch [35] iter: 392/563, elapsed: 9.964s, lr: 0.00004726 loss: 0.55364715\n",
      "Epoch [35] iter: 448/563, elapsed: 9.892s, lr: 0.00004665 loss: 0.48712224\n",
      "Epoch [35] iter: 504/563, elapsed: 9.910s, lr: 0.00004604 loss: 0.48855614\n",
      "Epoch [35] iter: 560/563, elapsed: 9.900s, lr: 0.00004544 loss: 0.56985087\n",
      "validating\n",
      "Saved weight as logs/m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963/weights_ep35it562-0.85486_loss1.8470.pth\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 35/562: val acc: 0.85486, loss: 1.84696, best: 0.85486@35\n",
      "Epoch [36] iter: 0/563, elapsed: 7.985s, lr: 0.00004540 loss: 0.76321621\n",
      "Epoch [36] iter: 56/563, elapsed: 9.717s, lr: 0.00004480 loss: 0.67167214\n",
      "Epoch [36] iter: 112/563, elapsed: 9.894s, lr: 0.00004421 loss: 0.52084670\n",
      "Epoch [36] iter: 168/563, elapsed: 9.824s, lr: 0.00004361 loss: 0.69976102\n",
      "Epoch [36] iter: 224/563, elapsed: 9.932s, lr: 0.00004302 loss: 0.66676499\n",
      "Epoch [36] iter: 280/563, elapsed: 9.941s, lr: 0.00004243 loss: 0.65562754\n",
      "Epoch [36] iter: 336/563, elapsed: 9.879s, lr: 0.00004185 loss: 0.76449289\n",
      "Epoch [36] iter: 392/563, elapsed: 9.929s, lr: 0.00004127 loss: 0.52994708\n",
      "Epoch [36] iter: 448/563, elapsed: 9.961s, lr: 0.00004069 loss: 0.80163825\n",
      "Epoch [36] iter: 504/563, elapsed: 9.948s, lr: 0.00004012 loss: 0.53875517\n",
      "Epoch [36] iter: 560/563, elapsed: 9.948s, lr: 0.00003955 loss: 0.99818853\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 36/562: val acc: 0.83541, loss: 0.60540, best: 0.85486@35\n",
      "Epoch [37] iter: 0/563, elapsed: 7.683s, lr: 0.00003952 loss: 0.42831147\n",
      "Epoch [37] iter: 56/563, elapsed: 9.762s, lr: 0.00003895 loss: 0.63265110\n",
      "Epoch [37] iter: 112/563, elapsed: 9.961s, lr: 0.00003838 loss: 0.56421283\n",
      "Epoch [37] iter: 168/563, elapsed: 9.941s, lr: 0.00003782 loss: 0.46979091\n",
      "Epoch [37] iter: 224/563, elapsed: 10.064s, lr: 0.00003727 loss: 0.94139013\n",
      "Epoch [37] iter: 280/563, elapsed: 9.916s, lr: 0.00003671 loss: 0.82422102\n",
      "Epoch [37] iter: 336/563, elapsed: 9.920s, lr: 0.00003616 loss: 0.64600736\n",
      "Epoch [37] iter: 392/563, elapsed: 9.933s, lr: 0.00003561 loss: 0.41733186\n",
      "Epoch [37] iter: 448/563, elapsed: 9.900s, lr: 0.00003507 loss: 0.47360409\n",
      "Epoch [37] iter: 504/563, elapsed: 10.003s, lr: 0.00003453 loss: 0.65488015\n",
      "Epoch [37] iter: 560/563, elapsed: 9.909s, lr: 0.00003399 loss: 0.80859389\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 37/562: val acc: 0.80350, loss: 0.65919, best: 0.85486@35\n",
      "Epoch [38] iter: 0/563, elapsed: 7.812s, lr: 0.00003397 loss: 0.49381614\n",
      "Epoch [38] iter: 56/563, elapsed: 9.754s, lr: 0.00003343 loss: 0.61772571\n",
      "Epoch [38] iter: 112/563, elapsed: 9.862s, lr: 0.00003290 loss: 0.73101069\n",
      "Epoch [38] iter: 168/563, elapsed: 9.923s, lr: 0.00003238 loss: 0.50036493\n",
      "Epoch [38] iter: 224/563, elapsed: 9.949s, lr: 0.00003186 loss: 0.81539884\n",
      "Epoch [38] iter: 280/563, elapsed: 9.898s, lr: 0.00003134 loss: 0.55298590\n",
      "Epoch [38] iter: 336/563, elapsed: 9.920s, lr: 0.00003082 loss: 0.50815874\n",
      "Epoch [38] iter: 392/563, elapsed: 9.892s, lr: 0.00003031 loss: 0.80806896\n",
      "Epoch [38] iter: 448/563, elapsed: 9.925s, lr: 0.00002980 loss: 0.74057443\n",
      "Epoch [38] iter: 504/563, elapsed: 9.892s, lr: 0.00002930 loss: 0.71758748\n",
      "Epoch [38] iter: 560/563, elapsed: 9.990s, lr: 0.00002880 loss: 0.47763748\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 38/562: val acc: 0.77082, loss: 0.45463, best: 0.85486@35\n",
      "Epoch [39] iter: 0/563, elapsed: 7.846s, lr: 0.00002877 loss: 0.58789104\n",
      "Epoch [39] iter: 56/563, elapsed: 9.739s, lr: 0.00002828 loss: 0.56799859\n",
      "Epoch [39] iter: 112/563, elapsed: 9.979s, lr: 0.00002779 loss: 0.71350474\n",
      "Epoch [39] iter: 168/563, elapsed: 9.863s, lr: 0.00002730 loss: 0.61349927\n",
      "Epoch [39] iter: 224/563, elapsed: 9.956s, lr: 0.00002681 loss: 0.68417189\n",
      "Epoch [39] iter: 280/563, elapsed: 9.895s, lr: 0.00002633 loss: 0.44206851\n",
      "Epoch [39] iter: 336/563, elapsed: 9.917s, lr: 0.00002586 loss: 0.63606215\n",
      "Epoch [39] iter: 392/563, elapsed: 9.968s, lr: 0.00002538 loss: 0.60879550\n",
      "Epoch [39] iter: 448/563, elapsed: 9.965s, lr: 0.00002491 loss: 0.67732406\n",
      "Epoch [39] iter: 504/563, elapsed: 9.965s, lr: 0.00002445 loss: 0.62038186\n",
      "Epoch [39] iter: 560/563, elapsed: 9.867s, lr: 0.00002399 loss: 0.41745516\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 39/562: val acc: 0.81401, loss: 0.59607, best: 0.85486@35\n",
      "Epoch [40] iter: 0/563, elapsed: 7.696s, lr: 0.00002396 loss: 0.36630745\n",
      "Epoch [40] iter: 56/563, elapsed: 9.711s, lr: 0.00002351 loss: 0.54536510\n",
      "Epoch [40] iter: 112/563, elapsed: 9.934s, lr: 0.00002305 loss: 0.44831544\n",
      "Epoch [40] iter: 168/563, elapsed: 9.912s, lr: 0.00002260 loss: 0.71576416\n",
      "Epoch [40] iter: 224/563, elapsed: 9.894s, lr: 0.00002216 loss: 0.75466430\n",
      "Epoch [40] iter: 280/563, elapsed: 9.914s, lr: 0.00002172 loss: 0.64510081\n",
      "Epoch [40] iter: 336/563, elapsed: 9.957s, lr: 0.00002128 loss: 0.51484541\n",
      "Epoch [40] iter: 392/563, elapsed: 9.931s, lr: 0.00002085 loss: 0.64795870\n",
      "Epoch [40] iter: 448/563, elapsed: 9.893s, lr: 0.00002042 loss: 0.81631020\n",
      "Epoch [40] iter: 504/563, elapsed: 10.004s, lr: 0.00001999 loss: 0.57545847\n",
      "Epoch [40] iter: 560/563, elapsed: 9.870s, lr: 0.00001957 loss: 0.50523894\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 40/562: val acc: 0.81362, loss: 0.46000, best: 0.85486@35\n",
      "Epoch [41] iter: 0/563, elapsed: 7.683s, lr: 0.00001955 loss: 0.52864922\n",
      "Epoch [41] iter: 56/563, elapsed: 9.782s, lr: 0.00001913 loss: 0.52147379\n",
      "Epoch [41] iter: 112/563, elapsed: 9.873s, lr: 0.00001872 loss: 0.72120901\n",
      "Epoch [41] iter: 168/563, elapsed: 9.887s, lr: 0.00001831 loss: 0.58396149\n",
      "Epoch [41] iter: 224/563, elapsed: 9.953s, lr: 0.00001791 loss: 0.49546070\n",
      "Epoch [41] iter: 280/563, elapsed: 9.894s, lr: 0.00001751 loss: 0.57590939\n",
      "Epoch [41] iter: 336/563, elapsed: 9.945s, lr: 0.00001712 loss: 0.58805930\n",
      "Epoch [41] iter: 392/563, elapsed: 9.955s, lr: 0.00001672 loss: 0.50589149\n",
      "Epoch [41] iter: 448/563, elapsed: 9.931s, lr: 0.00001634 loss: 0.56292698\n",
      "Epoch [41] iter: 504/563, elapsed: 9.915s, lr: 0.00001595 loss: 0.55134239\n",
      "Epoch [41] iter: 560/563, elapsed: 9.930s, lr: 0.00001558 loss: 0.64578278\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 41/562: val acc: 0.82023, loss: 1.88926, best: 0.85486@35\n",
      "Epoch [42] iter: 0/563, elapsed: 7.738s, lr: 0.00001556 loss: 0.46178942\n",
      "Epoch [42] iter: 56/563, elapsed: 9.693s, lr: 0.00001518 loss: 0.41819697\n",
      "Epoch [42] iter: 112/563, elapsed: 9.910s, lr: 0.00001481 loss: 0.44818422\n",
      "Epoch [42] iter: 168/563, elapsed: 9.858s, lr: 0.00001445 loss: 0.68556487\n",
      "Epoch [42] iter: 224/563, elapsed: 9.946s, lr: 0.00001409 loss: 0.68882332\n",
      "Epoch [42] iter: 280/563, elapsed: 9.958s, lr: 0.00001373 loss: 0.79781457\n",
      "Epoch [42] iter: 336/563, elapsed: 9.896s, lr: 0.00001338 loss: 0.52135740\n",
      "Epoch [42] iter: 392/563, elapsed: 9.941s, lr: 0.00001303 loss: 0.50959747\n",
      "Epoch [42] iter: 448/563, elapsed: 9.981s, lr: 0.00001268 loss: 0.55722604\n",
      "Epoch [42] iter: 504/563, elapsed: 9.921s, lr: 0.00001234 loss: 0.35389403\n",
      "Epoch [42] iter: 560/563, elapsed: 9.909s, lr: 0.00001201 loss: 0.65897027\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 42/562: val acc: 0.81595, loss: 0.50608, best: 0.85486@35\n",
      "Epoch [43] iter: 0/563, elapsed: 7.647s, lr: 0.00001199 loss: 0.35958522\n",
      "Epoch [43] iter: 56/563, elapsed: 9.753s, lr: 0.00001166 loss: 0.68545894\n",
      "Epoch [43] iter: 112/563, elapsed: 9.882s, lr: 0.00001134 loss: 0.60079734\n",
      "Epoch [43] iter: 168/563, elapsed: 9.940s, lr: 0.00001101 loss: 0.61158683\n",
      "Epoch [43] iter: 224/563, elapsed: 9.957s, lr: 0.00001070 loss: 0.69592732\n",
      "Epoch [43] iter: 280/563, elapsed: 9.914s, lr: 0.00001038 loss: 0.40293463\n",
      "Epoch [43] iter: 336/563, elapsed: 9.902s, lr: 0.00001008 loss: 0.61369601\n",
      "Epoch [43] iter: 392/563, elapsed: 9.994s, lr: 0.00000977 loss: 0.33755059\n",
      "Epoch [43] iter: 448/563, elapsed: 10.030s, lr: 0.00000947 loss: 0.53106908\n",
      "Epoch [43] iter: 504/563, elapsed: 9.975s, lr: 0.00000918 loss: 0.62766974\n",
      "Epoch [43] iter: 560/563, elapsed: 9.928s, lr: 0.00000889 loss: 0.46437564\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 43/562: val acc: 0.84319, loss: 0.60685, best: 0.85486@35\n",
      "Epoch [44] iter: 0/563, elapsed: 7.868s, lr: 0.00000887 loss: 0.71414115\n",
      "Epoch [44] iter: 56/563, elapsed: 9.665s, lr: 0.00000859 loss: 0.67678607\n",
      "Epoch [44] iter: 112/563, elapsed: 10.012s, lr: 0.00000831 loss: 0.73845726\n",
      "Epoch [44] iter: 168/563, elapsed: 9.900s, lr: 0.00000803 loss: 0.45160105\n",
      "Epoch [44] iter: 224/563, elapsed: 9.885s, lr: 0.00000776 loss: 0.96271717\n",
      "Epoch [44] iter: 280/563, elapsed: 9.927s, lr: 0.00000749 loss: 0.59498262\n",
      "Epoch [44] iter: 336/563, elapsed: 10.012s, lr: 0.00000723 loss: 0.74565204\n",
      "Epoch [44] iter: 392/563, elapsed: 9.911s, lr: 0.00000697 loss: 0.47160925\n",
      "Epoch [44] iter: 448/563, elapsed: 9.959s, lr: 0.00000672 loss: 0.55551169\n",
      "Epoch [44] iter: 504/563, elapsed: 10.085s, lr: 0.00000647 loss: 0.54942408\n",
      "Epoch [44] iter: 560/563, elapsed: 9.951s, lr: 0.00000623 loss: 0.62326488\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 44/562: val acc: 0.80117, loss: 0.58036, best: 0.85486@35\n",
      "Epoch [45] iter: 0/563, elapsed: 7.856s, lr: 0.00000622 loss: 0.55542432\n",
      "Epoch [45] iter: 56/563, elapsed: 9.813s, lr: 0.00000598 loss: 0.51010332\n",
      "Epoch [45] iter: 112/563, elapsed: 9.827s, lr: 0.00000574 loss: 0.67168381\n",
      "Epoch [45] iter: 168/563, elapsed: 9.877s, lr: 0.00000551 loss: 0.62954651\n",
      "Epoch [45] iter: 224/563, elapsed: 9.987s, lr: 0.00000529 loss: 0.56096002\n",
      "Epoch [45] iter: 280/563, elapsed: 9.964s, lr: 0.00000507 loss: 0.84478880\n",
      "Epoch [45] iter: 336/563, elapsed: 9.945s, lr: 0.00000485 loss: 0.83839397\n",
      "Epoch [45] iter: 392/563, elapsed: 10.028s, lr: 0.00000464 loss: 0.77486609\n",
      "Epoch [45] iter: 448/563, elapsed: 9.972s, lr: 0.00000443 loss: 0.37393594\n",
      "Epoch [45] iter: 504/563, elapsed: 9.978s, lr: 0.00000423 loss: 0.87996559\n",
      "Epoch [45] iter: 560/563, elapsed: 10.052s, lr: 0.00000404 loss: 0.49546490\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 45/562: val acc: 0.82451, loss: 0.47037, best: 0.85486@35\n",
      "Epoch [46] iter: 0/563, elapsed: 7.834s, lr: 0.00000403 loss: 0.82278240\n",
      "Epoch [46] iter: 56/563, elapsed: 9.749s, lr: 0.00000383 loss: 0.60714862\n",
      "Epoch [46] iter: 112/563, elapsed: 9.878s, lr: 0.00000365 loss: 0.58849284\n",
      "Epoch [46] iter: 168/563, elapsed: 9.995s, lr: 0.00000346 loss: 0.67543352\n",
      "Epoch [46] iter: 224/563, elapsed: 10.023s, lr: 0.00000329 loss: 0.58897843\n",
      "Epoch [46] iter: 280/563, elapsed: 9.884s, lr: 0.00000311 loss: 0.50878337\n",
      "Epoch [46] iter: 336/563, elapsed: 10.070s, lr: 0.00000295 loss: 0.76019423\n",
      "Epoch [46] iter: 392/563, elapsed: 9.922s, lr: 0.00000278 loss: 0.55162534\n",
      "Epoch [46] iter: 448/563, elapsed: 9.890s, lr: 0.00000262 loss: 0.75334762\n",
      "Epoch [46] iter: 504/563, elapsed: 9.910s, lr: 0.00000247 loss: 0.57139342\n",
      "Epoch [46] iter: 560/563, elapsed: 9.924s, lr: 0.00000232 loss: 0.63132631\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 46/562: val acc: 0.84358, loss: 0.60568, best: 0.85486@35\n",
      "Epoch [47] iter: 0/563, elapsed: 7.723s, lr: 0.00000231 loss: 0.42610483\n",
      "Epoch [47] iter: 56/563, elapsed: 9.824s, lr: 0.00000217 loss: 0.66731705\n",
      "Epoch [47] iter: 112/563, elapsed: 9.909s, lr: 0.00000203 loss: 0.35535635\n",
      "Epoch [47] iter: 168/563, elapsed: 9.868s, lr: 0.00000190 loss: 0.61746752\n",
      "Epoch [47] iter: 224/563, elapsed: 9.933s, lr: 0.00000177 loss: 0.84580748\n",
      "Epoch [47] iter: 280/563, elapsed: 9.937s, lr: 0.00000164 loss: 0.62292427\n",
      "Epoch [47] iter: 336/563, elapsed: 9.977s, lr: 0.00000152 loss: 0.79128378\n",
      "Epoch [47] iter: 392/563, elapsed: 9.952s, lr: 0.00000141 loss: 0.47246798\n",
      "Epoch [47] iter: 448/563, elapsed: 9.990s, lr: 0.00000130 loss: 0.62067570\n",
      "Epoch [47] iter: 504/563, elapsed: 10.032s, lr: 0.00000119 loss: 0.53918697\n",
      "Epoch [47] iter: 560/563, elapsed: 9.945s, lr: 0.00000109 loss: 0.50936015\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 47/562: val acc: 0.80078, loss: 0.45663, best: 0.85486@35\n",
      "Epoch [48] iter: 0/563, elapsed: 7.672s, lr: 0.00000109 loss: 0.74908804\n",
      "Epoch [48] iter: 56/563, elapsed: 9.754s, lr: 0.00000099 loss: 0.41827199\n",
      "Epoch [48] iter: 112/563, elapsed: 9.932s, lr: 0.00000090 loss: 0.60714397\n",
      "Epoch [48] iter: 168/563, elapsed: 9.993s, lr: 0.00000081 loss: 0.70049030\n",
      "Epoch [48] iter: 224/563, elapsed: 9.909s, lr: 0.00000073 loss: 0.77973715\n",
      "Epoch [48] iter: 280/563, elapsed: 10.006s, lr: 0.00000066 loss: 0.77354629\n",
      "Epoch [48] iter: 336/563, elapsed: 9.944s, lr: 0.00000059 loss: 0.56917742\n",
      "Epoch [48] iter: 392/563, elapsed: 9.989s, lr: 0.00000052 loss: 0.37517301\n",
      "Epoch [48] iter: 448/563, elapsed: 10.003s, lr: 0.00000046 loss: 0.38409162\n",
      "Epoch [48] iter: 504/563, elapsed: 9.893s, lr: 0.00000040 loss: 0.59719386\n",
      "Epoch [48] iter: 560/563, elapsed: 10.024s, lr: 0.00000035 loss: 0.56687637\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 48/562: val acc: 0.82335, loss: 1.90831, best: 0.85486@35\n",
      "Epoch [49] iter: 0/563, elapsed: 7.795s, lr: 0.00000035 loss: 0.68574249\n",
      "Epoch [49] iter: 56/563, elapsed: 9.790s, lr: 0.00000030 loss: 0.56087196\n",
      "Epoch [49] iter: 112/563, elapsed: 9.931s, lr: 0.00000026 loss: 0.65789439\n",
      "Epoch [49] iter: 168/563, elapsed: 9.977s, lr: 0.00000022 loss: 0.56720112\n",
      "Epoch [49] iter: 224/563, elapsed: 9.969s, lr: 0.00000019 loss: 0.57086603\n",
      "Epoch [49] iter: 280/563, elapsed: 9.957s, lr: 0.00000016 loss: 0.44808071\n",
      "Epoch [49] iter: 336/563, elapsed: 9.902s, lr: 0.00000014 loss: 0.60251900\n",
      "Epoch [49] iter: 392/563, elapsed: 10.051s, lr: 0.00000012 loss: 0.48169763\n",
      "Epoch [49] iter: 448/563, elapsed: 9.914s, lr: 0.00000011 loss: 0.64592866\n",
      "Epoch [49] iter: 504/563, elapsed: 9.993s, lr: 0.00000010 loss: 0.67125185\n",
      "Epoch [49] iter: 560/563, elapsed: 10.079s, lr: 0.00000010 loss: 0.58169027\n",
      "validating\n",
      "m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 | epoch/iter 49/562: val acc: 0.83658, loss: 0.60580, best: 0.85486@35\n",
      "Load best weight from logs/m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963/weights_ep35it562-0.85486_loss1.8470.pth\n",
      "testing\n",
      "Final test acc: 0.85863\n",
      "Finetuning m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-lr00025s7tx2 on circor2 -> mean score: 0.85863, best weight: logs/m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963/weights_ep35it562-0.85486_loss1.8470.pth, score file: logs/m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963/circor2_ar-m2d.M2D-FT_09fc2963_0.85863.csv, config: {'audio_repr': 'ar_m2d.AR_M2D', 'weight_file': '../m2d_vit_base-80x608p16x16-221006-mr7_enconly/checkpoint-300.pth', 'feature_d': 768, 'sample_rate': 16000, 'n_fft': 400, 'window_size': 400, 'hop_size': 160, 'n_mels': 80, 'f_min': 50, 'f_max': 8000, 'window': 'hanning', 'mean': tensor(-7.1000), 'std': tensor(4.2000), 'output_layers': [-1], 'encoder_only': True, 'dur_frames': None, 'freeze_embed': True, 'flat_features': True, 'batch_size': 128, 'lr_lineareval': 3e-05, 'report_per_epochs': 50, 'early_stop_epochs': 20, 'training_mask': 0.2, 'warmup_epochs': 5, 'mixup': 0.0, 'ft_bs': 32, 'ft_lr': 2.0, 'ft_early_stop_epochs': -1, 'ft_epochs': 50, 'ft_freq_mask': 0, 'ft_time_mask': 0, 'ft_noise': 0.0, 'ft_rrc': False, 'name': '', 'task_metadata': 'evar/metadata/circor2.csv', 'task_data': 'work/16k/circor2', 'unit_samples': 80000, 'id': 'm2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963', 'task_name': 'circor2', 'return_filename': False, 'optim': 'sgd', 'unit_sec': None, 'data_path': 'work', 'runtime_cfg': {'lr': 0.00025, 'seed': 7, 'hidden': [], 'mixup': 0.0, 'bs': 32, 'freq_mask': 0, 'time_mask': 0, 'rrc': False, 'epochs': 50, 'early_stop_epochs': -1, 'n_class': 3, 'id': '055fb028'}, 'input_size': [80, 608], 'patch_size': [16, 16], 'sr': '16k', 'model': 'm2d_vit_base_encoder_only', 'decoder_depth': 8}\n",
      "weight_file=../m2d_vit_base-80x608p16x16-221006-mr7_enconly/checkpoint-300.pth,encoder_only=True,freeze_embed=True\n",
      "+task_metadata=evar/metadata/circor2.csv,+task_data=work/16k/circor2,+unit_samples=80000\n",
      "\n",
      "Classes: ['Absent' 'Present' 'Unknown']\n",
      "Creating model: m2d_vit_base_encoder_only({'img_size': [80, 608], 'patch_size': [16, 16], 'decoder_depth': 8, 'norm_stats': tensor([-7.1000,  4.2000])})\n",
      "/lab/M2D2022prep/app/circor/evar/../m2d/models_mae.py:784: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).\n",
      "  self.norm_stats = nn.Parameter(torch.tensor(norm_stats), requires_grad=False)\n",
      " using 151 parameters from ../m2d_vit_base-80x608p16x16-221006-mr7_enconly/checkpoint-300.pth\n",
      " (dropped: [] )\n",
      "<All keys matched successfully>\n",
      "<All keys matched successfully>\n",
      "using random_structured_mask().\n",
      " ** Freeze patch_embed **\n",
      "PatchEmbed(\n",
      "  (proj): Conv2d(1, 768, kernel_size=(16, 16), stride=(16, 16))\n",
      "  (norm): Identity()\n",
      ")\n",
      "{'audio_repr': 'ar_m2d.AR_M2D', 'weight_file': '../m2d_vit_base-80x608p16x16-221006-mr7_enconly/checkpoint-300.pth', 'feature_d': 768, 'sample_rate': 16000, 'n_fft': 400, 'window_size': 400, 'hop_size': 160, 'n_mels': 80, 'f_min': 50, 'f_max': 8000, 'window': 'hanning', 'mean': tensor(-7.1000), 'std': tensor(4.2000), 'output_layers': [-1], 'encoder_only': True, 'dur_frames': None, 'freeze_embed': True, 'flat_features': True, 'batch_size': 128, 'lr_lineareval': 3e-05, 'report_per_epochs': 50, 'early_stop_epochs': 20, 'training_mask': 0.2, 'warmup_epochs': 5, 'mixup': 0.0, 'ft_bs': 32, 'ft_lr': 2.0, 'ft_early_stop_epochs': -1, 'ft_epochs': 50, 'ft_freq_mask': 0, 'ft_time_mask': 0, 'ft_noise': 0.0, 'ft_rrc': False, 'name': '', 'task_metadata': 'evar/metadata/circor2.csv', 'task_data': 'work/16k/circor2', 'unit_samples': 80000, 'id': 'm2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963', 'task_name': 'circor2', 'return_filename': False, 'optim': 'sgd', 'unit_sec': None, 'data_path': 'work', 'eval_checkpoint': PosixPath('logs/m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963/weights_ep35it562-0.85486_loss1.8470.pth'), 'runtime_cfg': {'lr': 0.00025, 'seed': 7, 'hidden': [], 'mixup': 0.0, 'bs': 32, 'freq_mask': 0, 'time_mask': 0, 'rrc': False, 'epochs': 50, 'early_stop_epochs': -1, 'n_class': 3, 'id': '055fb028'}, 'input_size': [80, 608], 'patch_size': [16, 16], 'sr': '16k', 'model': 'm2d_vit_base_encoder_only', 'decoder_depth': 8}\n",
      "Model input size: [80, 608]\n",
      "Using weights: ../m2d_vit_base-80x608p16x16-221006-mr7_enconly/checkpoint-300.pth\n",
      "training_mask: 0.2\n",
      "flat_features: True\n",
      "Runtime MelSpectrogram(16000, 400, 400, 160, 80, 50, 8000):\n",
      "MelSpectrogram(\n",
      "  Mel filter banks size = (80, 201), trainable_mel=False\n",
      "  (stft): STFT(n_fft=400, Fourier Kernel size=(201, 1, 400), iSTFT=False, trainable=False)\n",
      ")\n",
      " using spectrogram norimalization stats: [tensor(-7.1000), tensor(4.2000)]\n",
      "768 [] 3\n",
      "Backbone encoder:\n",
      "Total number of parameters: 85,400,834 (trainable 85,056,768)\n",
      "Trainable parameters: ['runtime.backbone.cls_token', 'runtime.backbone.blocks.0.norm1.weight', 'runtime.backbone.blocks.0.norm1.bias', 'runtime.backbone.blocks.0.attn.qkv.weight', 'runtime.backbone.blocks.0.attn.qkv.bias', 'runtime.backbone.blocks.0.attn.proj.weight', 'runtime.backbone.blocks.0.attn.proj.bias', 'runtime.backbone.blocks.0.norm2.weight', 'runtime.backbone.blocks.0.norm2.bias', 'runtime.backbone.blocks.0.mlp.fc1.weight'] ...\n",
      "Others are frozen such as: ['runtime.backbone.pos_embed', 'runtime.backbone.norm_stats', 'runtime.backbone.patch_embed.proj.weight'] ...\n",
      "Head:\n",
      "Total number of parameters: 2,307 (trainable 2,307)\n",
      "Trainable parameters: ['mlp.mlp.0.weight', 'mlp.mlp.0.bias']\n",
      "Others are frozen such as: [] \n",
      "Using checkpoint logs/m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963/weights_ep35it562-0.85486_loss1.8470.pth\n",
      "<All keys matched successfully>\n",
      "Test file folder: ../heart-murmur-detection/data/stratified_data2/test_data/\n",
      "Test files: ['13918', '14998'] ['../heart-murmur-detection/data/stratified_data2/test_data/13918.txt', '../heart-murmur-detection/data/stratified_data2/test_data/14998.txt']\n",
      "100%|█████████████████████████████████████████| 236/236 [00:22<00:00, 10.31it/s]\n",
      "Label decision follows: Panah et al. “Exploring Wav2vec 2.0 Model for Heart Murmur Detection.” EUSIPCO, 2023, pp. 1010–14.\n",
      "#Murmur scores\n",
      "AUROC,AUPRC,F-measure,Accuracy,Weighted Accuracy,UAR\n",
      "0.898,0.776,0.668,0.839,0.836,0.698\n",
      "\n",
      "#Murmur scores (per class)\n",
      "Classes,Present,Unknown,Absent\n",
      "AUROC,0.971,0.786,0.937\n",
      "AUPRC,0.916,0.448,0.966\n",
      "F-measure,0.785,0.312,0.907\n",
      "Accuracy,0.933,0.294,0.868\n",
      "\n",
      "Finetuning m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963- on circor2 -> weighted_accuracy: 0.83556. UAR: 0.69842, recall per class: [0.93333333 0.29411765 0.86781609], best weight: logs/m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963/weights_ep35it562-0.85486_loss1.8470.pth, config: {'audio_repr': 'ar_m2d.AR_M2D', 'weight_file': '../m2d_vit_base-80x608p16x16-221006-mr7_enconly/checkpoint-300.pth', 'feature_d': 768, 'sample_rate': 16000, 'n_fft': 400, 'window_size': 400, 'hop_size': 160, 'n_mels': 80, 'f_min': 50, 'f_max': 8000, 'window': 'hanning', 'mean': tensor(-7.1000), 'std': tensor(4.2000), 'output_layers': [-1], 'encoder_only': True, 'dur_frames': None, 'freeze_embed': True, 'flat_features': True, 'batch_size': 128, 'lr_lineareval': 3e-05, 'report_per_epochs': 50, 'early_stop_epochs': 20, 'training_mask': 0.2, 'warmup_epochs': 5, 'mixup': 0.0, 'ft_bs': 32, 'ft_lr': 2.0, 'ft_early_stop_epochs': -1, 'ft_epochs': 50, 'ft_freq_mask': 0, 'ft_time_mask': 0, 'ft_noise': 0.0, 'ft_rrc': False, 'name': '', 'task_metadata': 'evar/metadata/circor2.csv', 'task_data': 'work/16k/circor2', 'unit_samples': 80000, 'id': 'm2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963', 'task_name': 'circor2', 'return_filename': False, 'optim': 'sgd', 'unit_sec': None, 'data_path': 'work', 'eval_checkpoint': PosixPath('logs/m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963/weights_ep35it562-0.85486_loss1.8470.pth'), 'runtime_cfg': {'lr': 0.00025, 'seed': 7, 'hidden': [], 'mixup': 0.0, 'bs': 32, 'freq_mask': 0, 'time_mask': 0, 'rrc': False, 'epochs': 50, 'early_stop_epochs': -1, 'n_class': 3, 'id': '055fb028'}, 'input_size': [80, 608], 'patch_size': [16, 16], 'sr': '16k', 'model': 'm2d_vit_base_encoder_only', 'decoder_depth': 8}\n",
      "Probabilities saved as: probs/logs-m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-weights_ep35it562-0.85486_loss1.8470_1.npy\n",
      "Probabilities saved as: probs/logs-m2d_vit_base-80x608p16x16-221006-mr7_enconly-checkpoint-300_circor2_09fc2963-weights_ep35it562-0.85486_loss1.8470_2.npy\n"
     ]
    }
   ],
   "source": [
    "! python circor_eval.py config/m2d.yaml circor2 weight_file=../m2d_vit_base-80x608p16x16-221006-mr7_enconly/checkpoint-300.pth,encoder_only=True,freeze_embed=True --lr=0.00025 --freq_mask 0 --time_mask 0 --training_mask 0.2 --mixup 0.0 --rrc False --epochs 50 --warmup_epochs 5 --seed 7 --batch_size 32"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Check the results\n",
    "\n",
    "This resulted in weighted_accuracy: 0.82889 and UAR: 0.70654.\n",
    "\n",
    "The results are stored in results/circor-scores.csv."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>representation</th>\n",
       "      <th>task</th>\n",
       "      <th>wacc</th>\n",
       "      <th>uar</th>\n",
       "      <th>r_Present</th>\n",
       "      <th>r_Unknown</th>\n",
       "      <th>r_Absent</th>\n",
       "      <th>weight_file</th>\n",
       "      <th>run_id</th>\n",
       "      <th>report</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>circor2</td>\n",
       "      <td>circor2</td>\n",
       "      <td>0.835556</td>\n",
       "      <td>0.698422</td>\n",
       "      <td>0.933333</td>\n",
       "      <td>0.294118</td>\n",
       "      <td>0.867816</td>\n",
       "      <td>../m2d_vit_base-80x608p16x16-221006-mr7_enconl...</td>\n",
       "      <td>m2d_vit_base-80x608p16x16-221006-mr7_enconly-c...</td>\n",
       "      <td>Finetuning m2d_vit_base-80x608p16x16-221006-mr...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  representation     task      wacc       uar  r_Present  r_Unknown  r_Absent  \\\n",
       "0        circor2  circor2  0.835556  0.698422   0.933333   0.294118  0.867816   \n",
       "\n",
       "                                         weight_file  \\\n",
       "0  ../m2d_vit_base-80x608p16x16-221006-mr7_enconl...   \n",
       "\n",
       "                                              run_id  \\\n",
       "0  m2d_vit_base-80x608p16x16-221006-mr7_enconly-c...   \n",
       "\n",
       "                                              report  \n",
       "0  Finetuning m2d_vit_base-80x608p16x16-221006-mr...  "
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "pd.read_csv('results/circor-scores.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "ar",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.15"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
